<div ng-controller="addScoreLogCtrl"><!--TODO：2015-4-14-->
    <br>
    <p id="errorMsg" class="text-danger" ng-show="showErrorForQueryCondition==true">请选择小区...!</p>
    <form class="form-inline" role="form" id="searchTable" ng-submit="searchUser(search.selectedCommunity.objId,search.mobilePhone,search.nickName,search.isVUser,search.isTalent)">
            11选择小区：
             <select required  class="form-control"  ng-model="search.selectedCommunity" placeholder="选择小区"  ng-options="community.communityName for community in communityList" ng-change="selectCommunity()">
                <option>--Please Select--</option>
            </select>
            手机号:
            <input type="text" ng-model="search.mobilePhone"  size="8"  class="form-control">
            昵称:
            <input type="text" ng-model="search.nickName"    size="8"  class="form-control">
            V用户：
            <select class="form-control" ng-model="search.isVUser">
                <option></option>
                <option>是</option>
                <option>否</option>
            </select>
            达人：
             <select class="form-control" ng-model="search.isTalent">
                <option></option>
                <option>是</option>
                <option>否</option>
            </select>

            注册时间：
            <input type="text" id="startDate" class="form-control datepicker" size="12" data-date-format="yyyy-mm-dd"   ng-model="search.startDate"  >
            至：
            <input  type="text" id="endDate" class="form-control datepicker" size="12"  data-date-format="yyyy-mm-dd"  ng-model="search.endDate">
        <button type="submit" class="form-control btn btn-secondary" >Search</button>
    </form>

    <br>
    <!--TODO-->
    【getUserScoreAddRecord_result：：{{getUserScoreAddRecord_result}}】

    <br>
    <div class="tab-content" >

            <table class="table table-condensed" width="647">
                <thead>
                <tr>
                    <th>用户Id</th>
                    <th>手机号码</th>
                    <th>来源</th>
                    <th>昵称</th>
                    <th>小区</th>
                    <th>详细地址</th>
                    <th>V用户</th>
                    <th>达人</th>
                    <th>黑名单</th>
                    <th>创建日期</th>
                    <!--<th>操作</th>-->
                </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="user in userList.items">
                        <!--TODO：test，改回来，2015-4-14
                        <td>{{user.objId}}</td>
                        <td>{{user.mobilePhone}}</td>
                        <td>{{user.source}}</td>
                        <td>{{user.nickName}}</td>
                        <td>{{user.community.communityName}}</td>
                        <td>{{user.apartmentDetail}}</td>
                        <td  ng-show="user.authenticationStatus==true">是</td>
                        <td  ng-show="user.authenticationStatus==false">否</td>
                        <td ng-show="user.userType=='Talent'">是</td>
                        <td ng-show="user.userType!='Talent'">否</td>
                        <td ng-show="user.frozenOrNot==true">是</td>
                        <td ng-show="user.frozenOrNot==false">否</td>
                        <td>{{user.dateCreated  | date : 'yyyy-MM-dd'}}</td>-->
                        <!--<td>
                            <a class="btn btn-warning btn-xs" ng-show="user.frozenOrNot==false" ng-click="blackListConfig(user,0)" >拉黑</a>
                            <a class="btn btn-danger btn-xs" ng-show="user.frozenOrNot==true"  ng-click="blackListConfig(user,1)" >拉白</a>
                            <a class="btn btn-primary btn-xs"  ng-click="goDetail(user)" >详细信息</a>
                            <a class="btn btn-success btn-xs" ng-show="user.authenticationStatus==false&&user.frozenOrNot==false" ng-click="setOrCancelVUser(user,'把该用户设置为V用户吗？',true)">升级V</a>
                            <a class="btn btn-danger btn-xs" ng-show="user.authenticationStatus==true&&user.userType!='Talent'&&user.frozenOrNot==false" ng-click="setOrCancelVUser(user,'把该用户取消V用户吗？',false)">取消V</a>
                            <a class="btn btn-info btn-xs" ng-show="user.authenticationStatus==true&&user.userType!='Talent'&&user.frozenOrNot==false" ng-click="setOrCancelTalent(user,'把该用户升级为达人吗？','1')">升级达人</a>
                            <a class="btn btn-info btn-xs" ng-show="user.userType=='Talent'&&user.frozenOrNot==false" ng-click="setOrCancelTalent(user,'取消该用户的达人资格吗？','0')">取消达人</a>
                        </td>-->
                    </tr>
                    <tr>
                        <td></td>
                        <td colspan="9" align="center"></td>
                    </tr>
                </tbody>
            </table>
        <pagination num-pages="pages" curr-page="page" on-select-page="selectPage(page)"></pagination>
        </div>



    <div class="modal fade" id="userDetail" tabindex="-1"  role="dialog" aria-labelledby="helpModalLabel"  aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="userDetailTtiel">用户详细信息</h5>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">

                        <div class="form-group">
                                <div class="text-left col-sm-2">
                                    <img src="{{userDetail.images[0].imageURL}}" width="110" height="80" class="avatar img-circle">
                                </div>
                                <div class="form-group col-sm-3">
                                    <div>
                                        <label class="control-label">昵称：{{userDetail.nickName}}</label>
                                    </div>
                                    <div>
                                        <label class="control-label">手机：{{userDetail.mobilePhone}}</label>
                                    </div>
                                    <div>
                                        <label class="control-label ">小区：{{userDetail.community.communityName}}</label>
                                    </div>
                                </div>
                        </div>

                        <div class="form-group">
                            <label class="control-label col-sm-2">昵称:</label>
                            <div class="col-md-2">
                                <input class="form-control" type="text"  ng-model="userDetail.nickName">
                            </div>

                        </div>

                        <div class="form-group">
                            <label class="control-label col-sm-2">微信:</label>
                            <div class="col-md-3">
                                <input class="form-control" type="text" disabled="true" value="{{userDetail.wechatId}}">
                            </div>
                            <label class="control-label col-sm-2">电子邮件:</label>
                            <div class="col-md-3">
                                <input class="form-control" type="text" value="{{userDetail.email}}" disabled="true">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="control-label col-sm-2">性别:</label>
                            <div class="col-md-2">
                                <input class="form-control" type="text"  disabled="true" value="{{userDetail.gender}}">
                            </div>
                            <label class="control-label col-sm-3">出生年月:</label>
                            <div class="col-md-2">
                                <input class="form-control" type="text"  disabled="true" value="{{userDetail.birthDate}}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="control-label col-sm-2">是否达人:</label>
                            <div class="col-md-2">
                                <input class="form-control" type="text"  disabled="true" value="是" ng-show="userDetail.userType=='Talent'">
                                <input class="form-control" type="text"  disabled="true" value="否"  ng-show="userDetail.userType!='Talent'">
                            </div>
                            <label class="control-label col-sm-3">是否V用户:</label>
                            <div class="col-md-2">
                                <input class="form-control" type="text"  disabled="true" value="是" ng-show="userDetail.authenticationStatus==true">
                                <input class="form-control" type="text"  disabled="true" value="否" ng-show="userDetail.authenticationStatus==false">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="control-label col-sm-2">详细地址:</label>
                            <div class="col-md-9">
                                <input class="form-control" type="text"  disabled="true" value="{{userDetail.apartmentDetail}}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-2">单元:</label>
                            <div class="col-md-2">
                                <input class="form-control" type="text" ng-model="userDetail.roomUnit" >
                            </div>
                            <label class="control-label col-sm-3">房间号:</label>
                            <div class="col-md-2">
                                <input class="form-control" type="text" ng-model="userDetail.roomNumber" >
                            </div>
                        </div>

                    </form>

                </div>
                <div class="modal-footer">
                    <button id="saveButton1" type="submit" class="btn btn-default" ng-click="saveUserInfo(userDetail)">保存修改</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
                <br>
                <br>
            </div>
        </div>
    </div>

    <div class="modal fade" id="user_modal" tabindex="-1"  role="dialog" aria-labelledby="helpModalLabel"  aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <h5 class="modal-title" id="myModalLabel">{{popupTitle}}</h5>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" name="backendUserForm">
                        <div class="form-group">
                            <label for="nickName" id="nickName" class="control-label col-xs-2">用户昵称:</label>
                            <div class="col-xs-3">
                                <input type="text" class="form-control" ng-model="toBeBlackListUserNickName" id="userName" required placeholder="nickName">
                            </div>
                        </div>

                        <div class="form-group" id="reasonInput">
                            <label class="control-label  col-xs-2" for="reason">拉黑原因:</label>
                            <div  class="col-xs-6">
                                <textarea rows="6" class="form-control" ng-model="toBeBlackListUserReason" required></textarea>
                            </div>
                        </div>

                        <div class="modal-footer">
                            <button id="saveButton" type="submit" class="btn btn-default" ng-click="saveBlackListOrWhiteList(toBeBlackListUserObjId,toBeBlackListUserFrozen,toBeBlackListUserReason)">Save</button>
                            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<script>


    Date.prototype.format = function (format) {
        var o = {
            "M+": this.getMonth() + 1, //month
            "d+": this.getDate(), //day
            "h+": this.getHours(), //hour
            "m+": this.getMinutes(), //minute
            "s+": this.getSeconds(), //second
            "q+": Math.floor((this.getMonth() + 3) / 3), //quarter
            "S": this.getMilliseconds() //millisecond
        }
        if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
                (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o) if (new RegExp("(" + k + ")").test(format))
            format = format.replace(RegExp.$1,
                    RegExp.$1.length == 1 ? o[k] :
                            ("00" + o[k]).substr(("" + o[k]).length));
        return format;
    }

    var fromDate = $('#startDate').datepicker().on('changeDate', function(ev){
        //alert(ev.date.format('yyyy-MM-dd'));
        //$scope.startDate=ev.date.format('yyyy-MM-dd');
        $("#startDate").val(ev.date.format('yyyy-MM-dd'));
    });

    var toDate = $('#endDate').datepicker().on('changeDate', function(ev){
       // alert(ev.date.format('yyyy-MM-dd'));
        //$scope.endDate=ev.date.format('yyyy-MM-dd');
        $("#endDate").val(ev.date.format('yyyy-MM-dd'));
    });

</script>
